﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace VersionComparer.Base
{
    
    public class WorkerInfo<T> : WorkerInfoBase
    {
        #region fields
        ManagedThread threadManaged;
        #endregion fields

        #region constructors
        public WorkerInfo(string name, Action<ManagedThread , T> action, T argument, BackgroundWorker worker)
            : base(name, worker)
        {
            threadManaged = new ManagedThread(worker);
            Action = action;
            Argument = argument;
        }
        #endregion constructors

        #region properties
        public Action<ManagedThread , T> Action
        {
            get;
            private set;
        }
        public T Argument
        {
            get;
            private set;
        }
        #endregion properties

        /// <summary>
        /// Executes the action
        /// </summary>
        public override void Execute( )
        {
            Action(threadManaged, Argument);
            Terminated();
        }

    }
}
